package com.xinchao.ck_mips.base;

import java.lang.ref.WeakReference;

/**
 * Created by wq on 2019/4/24.
 */
public abstract class MyBasePresenter<T> {
    protected WeakReference<T> mRefView;

    /**
     * 绑定
     *
     * @param view
     */
    public void attachView(T view) {
        mRefView = new WeakReference<T>(view);
    }

    /**
     * 解绑
     */
    public void detachView() {
        if (mRefView != null) {
            mRefView.clear();
            mRefView = null;
        }
    }

    public T getView() {
        return mRefView.get();
    }

}
